package system.student.entity.signin;

import java.time.LocalDateTime;
import java.util.List;

public class SignInTask {
    private Long id;
    private Long teacherId;
    private String taskName;
    private List<Long> studentIds;

    private LocalDateTime startTime;
    private LocalDateTime endTime;
    private Integer state;

    private SignInState signInState = SignInState.Pending;
    private void updateSignInState() {
        this.signInState = this.signInState.next(this);
    }
    public Boolean signIn(Long id){
        updateSignInState();
        if(signInState == SignInState.Pending){
            System.out.println("签到还未开始");
            return false;
        }else if(signInState == SignInState.Ongoing){
            System.out.println("签到成功");
            return true;
        }else {
            System.out.println("签到已经结束");
            return false;
        }
    }

    public Long getTeacherId() {
        return teacherId;
    }

    public void setTeacherId(Long teacherId) {
        this.teacherId = teacherId;
    }

    public String getTaskName() {
        return taskName;
    }

    public void setTaskName(String taskName) {
        this.taskName = taskName;
    }

    public LocalDateTime getStartTime() {
        return startTime;
    }

    public void setStartTime(LocalDateTime startTime) {
        this.startTime = startTime;
    }

    public LocalDateTime getEndTime() {
        return endTime;
    }

    public void setEndTime(LocalDateTime endTime) {
        this.endTime = endTime;
    }

    public SignInTask(Long id,Long teacherId, String taskName, LocalDateTime startTime, LocalDateTime endTime) {
        this.id = id;
        this.teacherId = teacherId;
        this.taskName = taskName;
        this.startTime = startTime;
        this.endTime = endTime;
    }

    public SignInTask(Long teacherId, String taskName, List<Long> studentIds, LocalDateTime startTime, LocalDateTime endTime, Integer state) {
        this.teacherId = teacherId;
        this.studentIds = studentIds;
        this.taskName = taskName;
        this.startTime = startTime;
        this.endTime = endTime;
        this.state = state;
    }

    public SignInTask() {
    }

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public SignInState getSignInState() {
        return signInState;
    }

    public List<Long> getStudentIds() {
        return studentIds;
    }

    public void setStudentIds(List<Long> studentIds) {
        this.studentIds = studentIds;
    }


    public Integer getState() {
        return state;
    }

    public void setState(Integer state) {
        this.state = state;
    }
}
